package configmodel

import (
	"cmdb-go/structmodel"
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"os"
)


func ConfigGet() (config structmodel.Cfg){
	file, err := os.Open("./config.yaml")
	if err != nil {
		panic(err)
	}
	bytes, err := ioutil.ReadAll(file)
	if err != nil {
		panic(err)
	}
	cfg := structmodel.Cfg{}
	err = yaml.Unmarshal(bytes, &cfg)
	if err != nil {
		panic(err)
	}
	return cfg
}

